package org.yxing.demo.test;

import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.widget.Toast;

public class Activity1 extends ActionBarActivity {
    /** Called when the activity is first created. */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        setTitle("xxxxxxxxxxxxx");
    }
    
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main, menu);
        
        return super.onCreateOptionsMenu(menu);
    }
    
    protected void onCreateActionbar(ActionBar actionBar) {
        super.onCreateActionbar(actionBar);
        actionBar.addItem(1, R.drawable.ic_action_refresh);
        actionBar.addItem(2, R.drawable.ic_action_search);
        actionBar.addItem(3, R.drawable.ic_action_search);
    }
    
    protected void onActionBarItemSelected(ActionBarItem item) {
        super.onActionBarItemSelected(item);
        String str = null;
        switch (item.getId()) {
        case 1:
            str = "refresh";
            break;
        case 2:
            str = "serce";
            break;
        }
        
        Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
    }
    
}